package com.wyf.order.controller;


import com.wyf.order.feign.DynamicFeignClient;
import com.wyf.order.feign.StockFeignService;
import feign.Client;
import feign.Feign;
import feign.form.FormEncoder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/order")
public class OrderController {

//    @Resource
//    StockFeignService stockFeignService;

    @Resource
    DynamicFeignClient<StockFeignService> stockFeignServiceDynamicFeignClient;

    @RequestMapping("/add")
    public String add() {
//        System.out.println("下单成功");
        StockFeignService feignClient = stockFeignServiceDynamicFeignClient.getFeignClient(StockFeignService.class, "stock-service");
        //        String msg = stockFeignService.reduct2();
        return feignClient.reduct2();
    }
}
